import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '设备',
    align:"center",
    dataIndex: 'deviceId_dictText'
   },
   {
    title: '人员',
    align:"center",
    dataIndex: 'personName'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createDate'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "设备",
      field: 'deviceId',
      component: 'JSearchSelect',
      componentProps:{
         dict:"ss_device,device_name,id"
      },
      //colProps: {span: 6},
 	},
	{
      label: "人员",
      field: 'personName',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '设备',
    field: 'deviceId',
    component: 'JSearchSelect',
    componentProps:{
       dict:"ss_device where device_type='4',device_name,id"
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入设备ID!'},
          ];
     },
  },
  {
    label: '人员',
    field: 'personId',
    component: 'JSelectPerson',
    componentProps: {
      labelKey: 'name',
      isRadioSelection: true,
	  showButtom:false
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择人员!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  deviceId: {title: '设备ID',order: 0,view: 'number', type: 'number',dictTable: 'ss_device', dictCode: 'id', dictText: 'device_name',},
  personId: {title: '人员ID',order: 1,view: 'number', type: 'number',},
  createBy: {title: '创建人',order: 2,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}